package com.tjcm.tjcminspectmanager;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import cn.emagsoftware.ui.staticmanager.StaticManager;

import com.tjcm.tjcminspectmanager.model.HiddenTroubleItem;

public class TroubleDetailActivity extends BaseActivity
{

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        if (!LoginActivity.IS_APP_RUNNING)
        {
            StaticManager.restartAppWhenDalvikRecycled(this, LoginActivity.class);
            return;
        }
        Intent intent = getIntent();
        HiddenTroubleItem item = (HiddenTroubleItem) intent.getSerializableExtra("TROUBLE_ITEM");
        String lonStr = intent.getStringExtra("LON");
        String latStr = intent.getStringExtra("LAT");

        setContentView(R.layout.troubledetail);

        TextView type = (TextView) findViewById(R.id.type);
        TextView troubletype = (TextView) findViewById(R.id.troubletype);
        TextView status = (TextView) findViewById(R.id.status);
        TextView lon = (TextView) findViewById(R.id.lon);
        TextView lat = (TextView) findViewById(R.id.lat);
        TextView time = (TextView) findViewById(R.id.time);
        TextView desc = (TextView) findViewById(R.id.desc);
        Button back = (Button) findViewById(R.id.back);

        type.setText(item.specialtyType);
        troubletype.setText(item.troubleType);
        status.setText(item.troubleStatus);
        lon.setText(lonStr);
        lat.setText(latStr);
        time.setText(item.timeStamp);
        desc.setText(item.memo);
        back.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                // TODO Auto-generated method stub
                finish();
            }
        });
    }

}